home *** CD-ROM | disk | FTP | other *** search
/ Champak 49 / Volume 49 - JOGO DISK .iso / Games / fun_game1.swf / scripts / __Packages / Cubix.as
Encoding:
Text File  |  2007-09-27  |  3.2 KB  |  118 lines

  1. class Cubix extends MovieClip
  2. {
  3.    var nameV;
  4.    var numberV;
  5.    var typeV;
  6.    var widthV;
  7.    var heightV;
  8.    var xPosSV;
  9.    var yPosSV;
  10.    var backM;
  11.    var shadowM;
  12.    var lineM;
  13.    var numberWin;
  14.    var intervalIDV;
  15.    var xPosV;
  16.    var yPosV;
  17.    var moveTypeNumV;
  18.    var fpsV = 70;
  19.    var intervalSecV = 1000 / this.fpsV;
  20.    var delaySecV = 300;
  21.    var moveSpeedV = 0.1;
  22.    var checkTrig = false;
  23.    var colorStartV = 0;
  24.    function Cubix()
  25.    {
  26.       super();
  27.    }
  28.    function intF(nameV, numberV, typeV, widthV, heightV, xPosSV, yPosSV, colorStartV)
  29.    {
  30.       this.nameV = nameV;
  31.       this.numberV = numberV;
  32.       this.typeV = typeV;
  33.       this.widthV = widthV;
  34.       this.heightV = heightV;
  35.       this.xPosSV = xPosSV;
  36.       this.yPosSV = yPosSV;
  37.       this.colorStartV = colorStartV;
  38.       this.backM._width = this.widthV - 4;
  39.       this.backM._height = this.heightV - 4;
  40.       this.shadowM._width = this.widthV;
  41.       this.shadowM._height = this.heightV;
  42.       this.lineM._width = this.widthV - 4;
  43.       this.lineM._height = this.heightV - 4;
  44.    }
  45.    function showTestWinF()
  46.    {
  47.       this.numberWin.text = this.numberV;
  48.    }
  49.    function setTypeF(typeV)
  50.    {
  51.       this.typeV = typeV;
  52.    }
  53.    function changeTypeF(typeV)
  54.    {
  55.       this.typeV = typeV;
  56.       this.backM.gotoAndStop("s" + Number(Number(this.typeV) + Number(this.colorStartV)) + "L");
  57.    }
  58.    function changeInfoArrayPositionF(xPosSV, yPosSV)
  59.    {
  60.       this.xPosSV = xPosSV;
  61.       this.yPosSV = yPosSV;
  62.    }
  63.    function changeInfoStagePositionF(xPosV, yPosV, moveTypeNumV, moveSpeedV)
  64.    {
  65.       clearInterval(this.intervalIDV);
  66.       this.xPosV = xPosV;
  67.       this.yPosV = yPosV;
  68.       this.moveTypeNumV = moveTypeNumV;
  69.       this.moveSpeedV = moveSpeedV;
  70.       if(this.moveTypeNumV == 1)
  71.       {
  72.          this.intervalIDV = setInterval(this,"moveStagePositionF2",this.intervalSecV);
  73.       }
  74.       else if(this.moveTypeNumV == 2)
  75.       {
  76.          this.intervalIDV = setInterval(this,"delayF",this.delaySecV);
  77.       }
  78.       else if(this.moveTypeNumV == 3)
  79.       {
  80.          this.intervalIDV = setInterval(this,"moveStagePositionF2",this.intervalSecV);
  81.       }
  82.    }
  83.    function delayF()
  84.    {
  85.       clearInterval(this.intervalIDV);
  86.       this.intervalIDV = setInterval(this,"moveStagePositionF3",this.intervalSecV);
  87.    }
  88.    function moveStagePositionF1()
  89.    {
  90.       this._x = this.xPosV;
  91.       this._y = this.yPosV;
  92.    }
  93.    function moveStagePositionF2()
  94.    {
  95.       this._x += (this.xPosV - this._x) * this.moveSpeedV;
  96.       this._y += (this.yPosV - this._y) * this.moveSpeedV;
  97.       if(Math.abs(this.xPosV - this._x) < 1 and Math.abs(this.yPosV - this._y) < 1)
  98.       {
  99.          this._x = this.xPosV;
  100.          this._y = this.yPosV;
  101.          clearInterval(this.intervalIDV);
  102.          _root.moveEndCheckF1();
  103.       }
  104.    }
  105.    function moveStagePositionF3()
  106.    {
  107.       this._x += (this.xPosV - this._x) * this.moveSpeedV;
  108.       this._y += (this.yPosV - this._y) * this.moveSpeedV;
  109.       if(Math.abs(this.xPosV - this._x) < 1 and Math.abs(this.yPosV - this._y) < 1)
  110.       {
  111.          this._x = this.xPosV;
  112.          this._y = this.yPosV;
  113.          clearInterval(this.intervalIDV);
  114.          _root.moveEndCheckF2();
  115.       }
  116.    }
  117. }
  118.